import {
  Table,
  Model,
  Column,
  DataType,
  // HasMany,
  PrimaryKey,
  AutoIncrement,
  Unique,
  AllowNull,
  Comment,
} from 'sequelize-typescript';
// import { House } from './house.entity';
// import { Visitor } from './visitor.entity';

@Table({
  comment: '用户表',
  tableName: 'user',
})
export class User extends Model {
  @PrimaryKey
  @AutoIncrement
  @Unique
  @AllowNull(false)
  @Comment('用户id')
  @Column(DataType.BIGINT)
  id: number;

  @AllowNull(false)
  @Comment('用户手机号')
  @Column(DataType.BIGINT('11'))
  phone: number;

  @Comment('业主昵称')
  @Column(DataType.STRING(50))
  nickName: string;

  @Comment('用户头像')
  @Column(DataType.STRING)
  avatar: string;

  @Comment('业主性别0女1男')
  @Column(DataType.ENUM('0', '1'))
  gender: number;

  @Comment('业主姓名')
  @Column(DataType.STRING(50))
  name: string;

  // @HasMany(() => House)
  // houses: House[];

  // @HasMany(() => Visitor)
  // visitors: Visitor[];
}
